#include <iostream>
using namespace std;

#define DBGLOG 0
#define INFLOG 1
#define ERRLOG 2
#define DEFAULTLOG INFLOG

#define LOG(level, log_level, format, ...)             \
    {                                       \
        if (level >= DEFAULTLOG)             \
        {                                   \
            time_t t = time(NULL);          \
            struct tm *ltm = localtime(&t); \
            char tmp[32] = {0};             \
            fprintf(stdout, "[%s %s:%d] [%s]\n\t" format "\n", tmp, __FILE__, __LINE__, log_level, ##__VA_ARGS__);\
        }                                   \
}

#define DLOG(format, ...) LOG(DBGLOG, "Debug", format, ##__VA_ARGS__)
#define ILOG(format, ...) LOG(INFLOG, "Info", format, ##__VA_ARGS__)
#define ELOG(format, ...) LOG(ERRLOG, "Error", format, ##__VA_ARGS__)

int main()
{
    int a = 3;
    DLOG("hello world %d", a--);
    ILOG("hello world %d", a--);
    ELOG("hello world %d", a--);
    return 0;
}